Flatpak

Installing OpenCPN using flatpak

The opencpn flatpak build is targeting Linux users on distros includiing (but not limited to) Fedora, Arch, SuSE and non-LTS Ubuntu releases. It is also the the supported way to install OpenCPN on RPi-4 and other high-end aarch64 system. Flatpak is not supported on Raspbian, it is only available for amd64/x86_64 and aarch64 hardware.

To install the Flatpak version of OpenCPN, first install flatpak as described in https://flatpak.org/setup/.

Then, install OpenCPN:

$ flatpak install --user \
    https://dl.flathub.org/repo/appstream/org.opencpn.OpenCPN.flatpakref

The initial installation is possibly huge, around 450Mb, This is a one-time setup download, later updates weighs in at about 50 Mb or less. Updates can be retrieved using

flatpak update org.opencpn.OpenCPN

The flatpak installation is integrated in the desktop. Using for example gnome the flatpak'ed opencpn can be started like any other application. It can also be started from the command line using:

$ flatpak run org.opencpn.OpenCPN

Verifying installation

To verify the installation flatpak list can be used to get information below:

 $ flatpak list
Name                 Application ID                        Version         Branch Origin         Installation
Freedesktop Platform org.freedesktop.Platform              18.08.39        18.08  flathub        system
Intel                org.freedesktop.Platform.VAAPI.Intel                  18.08  flathub        system
html5-codecs         org.freedesktop.Platform.html5-codecs                 18.08  flathub        system
Freedesktop SDK      org.freedesktop.Sdk                   18.08.39        18.08  flathub        system
OpenCPN              org.opencpn.OpenCPN                   5.2.0-0 4d956e1 test   opencpn-origin user

Configuration files like opencpn.log, opencpn.conf and installed plugins otherwise found at ~/.opencpn exists in ~/.var/app/org.opencpn.OpenCPN/config/opencpn

A regular OpenCPN installation installed using apt and flatpak OpenCPN can be used side by side, the configurations are independent of each other.

Updating OpenCPN

To update the system to the latest version:

$ flatpak update org.opencpn.OpenCPN

The installed plugins and configuration are not affected by an uninstall and reinstall.

Configuring the USB dongle

If the USB dongle is not found try:

USB Dongle Troubleshoot

Flatpak Access to Directories

Out of the box, the Flatpak package can access files in the home directory. As long as charts are installed here no actions needs to be taken. However, if charts needs to be stored outside of $HOME (for exampe on an USB stick) flatpak must be given access to the used directories using something like

  $ flatpak override --user org.opencpn.OpenCPN  --filesystem=/usr/local/charts

More information: https://docs.flatpak.org/en/latest/sandbox-permissions.html

Flatpak Access to Serial Devices

Out of the box, most Linux distribution restrict access to devices like /dev/ttyUSB0 or /dev/ttyS0. This means that such devices are not visible in the Flatpak sandbox and thus invisible and unusable also in OpenCPN.

To fix this, create a file named like 70-serial-opencpn.rules with contents like

  KERNEL=="ttyUSB*", MODE="0666"
  KERNEL=="ttyACM*", MODE="0666"
  KERNEL=="ttyS*", MODE="0666"
  

Usually, only one line is required; for example when using /dev/ttyUSB0 only the first line needs to exist. Copy the file to /etc/udev/rules.d/ using sudo cp 70-serial-opencpn.rules /etc/udev/rules.d/. To activate rule run sudo udevadm control –reload-rules && sudo udevadm trigger. Or just reboot. When active, the device in question will be visible in OpenCPN.

The basic test is to check the permissions of the device which should be 666 (i. e., crw-rw-rw) when listed using for example ls -l /dev/ttyUSB0

A related problem is that devices like /dev/ttyUSB0 can change name to /dev/ttyUSB1 after a suspend-resume cycle, for example when closing and re-opening a laptop lid. See the file LINUX_DEVICES.md for more info